/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package api.gest;

import api.dom.Cliente;
import java.util.ArrayList;

/**
 *
 * @author Enrico
 */
public class GestCliente {
    private ArrayList<Cliente> mColCliente = new ArrayList<Cliente>();
    private static GestCliente objGestC = null;
    
      public static GestCliente getInstance()
  {
        if (objGestC == null){
            objGestC = new GestCliente();
            }
        return objGestC;
  }
      
      public boolean verificarCliente(Cliente xObjP){
          for(Cliente p: mColCliente){
              if(p.getpNumero()==xObjP.getpNumero()){
                 return true;
              }                 
          }
          return false;
      }
      
      public boolean altaCliente(Cliente xObjP){
          if(!verificarCliente(xObjP)){
              mColCliente.add(xObjP);
              return true;
          }
          return false;
      }
      
      public boolean bajaCliente(Cliente xObjP){
          mColCliente.remove(xObjP);
          return true;
      }
      
      public ArrayList<Cliente> devolverCliente(){
          return mColCliente;
      }
      
      public boolean modificarCliente(Cliente xObjP){
          mColCliente.set(mColCliente.indexOf(xObjP), xObjP);
          return true;
      }
      
      
      
      
   
}
